package day22.SecondTest;

import java.util.Scanner;

abstract class Media {
    private String name;

    public Media(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    abstract double getDailyRent();
}

class Book extends Media {
    private double price;

    public Book(String name, double price) {
        super(name);
        this.price = price;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Override
    double getDailyRent() {
        return 0;
    }
}

class DVD extends Media {
    public DVD(String name) {
        super(name);
    }

    @Override
    double getDailyRent() {
        return 0;
    }
}

class MediaShop {
    static double calculateRent(Media[] medias, int days) {
        double sum = 0;

        for (Media media : medias) {
            if (media instanceof Book) {
                double price = ((Book) media).getPrice() * 0.01;
                sum += price;
            }
            if (media instanceof DVD) {
                double price = 1;
                sum += price;
            }
        }
        double sum1 = days * sum;
        return sum1;
    }
}

public class Main2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Media[] ms = new Media[n];
        for (int i = 0; i < n; i++) {
            String type = sc.next();
            if (type.equals("book")) {
                ms[i] = new Book(sc.next(), sc.nextDouble());
            } else {
                ms[i] = new DVD(sc.next());
            }
        }
        double rent = MediaShop.calculateRent(ms, sc.nextInt());
        System.out.printf("%.2f", rent);
    }
}
